package worldinruin.core;

import static org.junit.Assert.*;

import org.junit.Test;

import worldinruin.core.imp.Resources;

public class ResourceTest {

	@Test
	public void testAdd(){
		IResources r = new Resources(0, 0, 0, 0);
		
		IResources re = r.addFood(4);
		
		assertTrue(re.getFood()==4);

		re = r.addIron(2);
		assertTrue(re.getIron()==2);
	}
	
	@Test
	public void testRemove(){
		IResources r = new Resources(4, 0, 5, 0);
		Resources re = new Resources(2, 0, 3, 0);
		
		assertTrue(r.subtract(re).equals(new Resources(2,0,2,0)));
	}
	
	@Test
	public void testAffordable(){
		IResources r = new Resources(4,2,0,0);
		IResources re = new Resources(2,1,0,0);
		IResources re2 = new Resources(1,1,1,1);
		
		assertTrue(r.isAffordable(re));
		assertTrue(!r.isAffordable(re2));
	}
	
	@Test
	public void testMultiply(){
		IResources r = new Resources(4,2,3,0);
		IResources re = r.multiply(2);

		assertTrue(re.equals(new Resources(8, 4, 6, 0)));
		
	}
	
}
	
